package vg.services.graph_view_manager.realization.graph_view.smart_graph_view.shared;

import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.interfaces.ISGVPatch;
import vg.services.graph_view_manager.realization.graph_view.smart_graph_view.interfaces.ISGVPatchManager;
import vg.services.main_manager.MainManager;

/**
 * Shared static methods.
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class Utils {
	/**
	 * Adds patch to patch manager and wait result.
	 */
	public static void add_patch2patch_manager_and_wait_result(ISGVPatchManager sgv_patch_manager, ISGVPatch patch) {
		int id = sgv_patch_manager.addPatch(patch);
		while(!sgv_patch_manager.isComplete(id)) {
			try {
				Thread.sleep(100);
			} catch (Exception ex) {
				MainManager.log.printException(ex);
			}
		}
	}
}
